package com.management.controller;


import com.management.controller.form.FindMonthByConditionForm;
import com.management.controller.form.GetAllProjectPageForm;
import com.management.service.WorktimeLogService;
import com.management.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 龙世超
 * @since 2022-03-23
 */
@Api(tags = "工时相关")
@RestController
@RequestMapping("/worktimeLog")
public class WorktimeLogController {

    @Resource
    private WorktimeLogService worktimeLogService;

    /**
     * 获取所有项目
     * @return
     */
    @ApiOperation("获取所有项目")
    @GetMapping("/GetProject")
    public Result GetProject(){
        return worktimeLogService.FindProject();
    }

    /**
     * 获取工时表并分页
     * @param getAllProjectPageForm
     * @return
     */
    @ApiOperation("获取工时表并分页")
    @PostMapping("/GetAllProject")
    public Result GetAllProject(@RequestBody GetAllProjectPageForm getAllProjectPageForm){
        return worktimeLogService.FindAllProjects(getAllProjectPageForm);
    }

    @ApiOperation("查询月度报表")
    @GetMapping("findAallMonthlyReport")
    public Result<?> findAallMonthlyReport(FindMonthByConditionForm findMonthByConditionForm){

        return worktimeLogService.getAllMonthlyReport(findMonthByConditionForm);
    }
}

